/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmRoladorRequiem.java
 *
 * Created on 29/09/2011, 10:58:00
 */
package viewer;

/**
 *
 * @author yurifw
 */
public class FrmRoladorRequiem extends javax.swing.JInternalFrame {

    /** Creates new form FrmRoladorRequiem */
    public FrmRoladorRequiem() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblParadaDados = new javax.swing.JLabel();
        btoRolar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtRolagem = new javax.swing.JTextArea();
        txtParadaDados = new javax.swing.JTextField();
        lblSucessos = new javax.swing.JLabel();
        lblResult = new javax.swing.JLabel();
        btoSair = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Rolador de Dados - Requiem");

        lblParadaDados.setText("Parada de Dados:");

        btoRolar.setText("Rolar");
        btoRolar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btoRolarActionPerformed(evt);
            }
        });

        txtRolagem.setColumns(20);
        txtRolagem.setRows(5);
        txtRolagem.setLineWrap(true);
        txtRolagem.setWrapStyleWord(true);
        jScrollPane1.setViewportView(txtRolagem);

        lblSucessos.setText("Sucessos:");

        btoSair.setText("x");
        btoSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btoSairActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(164, 164, 164)
                        .addComponent(btoRolar))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(lblSucessos)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblResult)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(361, Short.MAX_VALUE)
                .addComponent(btoSair))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(lblParadaDados)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(txtParadaDados, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(190, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(75, 75, 75)
                .addComponent(btoRolar)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSucessos)
                    .addComponent(lblResult))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                .addComponent(btoSair))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(37, 37, 37)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblParadaDados)
                        .addComponent(txtParadaDados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(255, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btoRolarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btoRolarActionPerformed
        // botão Rolar

        if (btoRolar.getText().equals("Rolar")) {
            if (txtParadaDados.getText().equals("666")) {
                String lyrics = "'Woe to you, Oh Earth and Sea, for the Devil sends the\n"
                        + "beast with wrath, because he knows the time is short...\n"
                        + "Let him who hath understanding reckon the number of the\n"
                        + "beast for it is a human number, its number is Six hundred and\n"
                        + "sixty six.\n'"
                        + "\n"
                        + "I left alone my mind was blank\n"
                        + "I needed time to think to get the memories from my mind\n"
                        + "\n"
                        + "What did I see can I believe that what I saw\n"
                        + "that night was real and not just fantasy\n"
                        + "\n"
                        + "Just what I saw in my old dreams were they\n"
                        + "reflections of my warped mind staring back at me\n"
                        + "\n"
                        + "'Cos in my dream it's always there the evil face that twists my mind\n"
                        + "and brings me to despair\n"
                        + "\n"
                        + "The night was black was no use holding back\n"
                        + "'Cos I just had to see was someone watching me\n"
                        + "In the mist dark figures move and twist\n"
                        + "Was this all for real or some kind of hell\n"
                        + "666 the number of the beast\n"
                        + "Hell and fire was spawned to be released\n"
                        + "\n"
                        + "Torches blazed and sacred chants were praised\n"
                        + "As they start to cry hands held to the sky\n"
                        + "In the night the fires burning bright\n"
                        + "The ritual has begun Satan's work is done\n"
                        + "666 the number of the beast\n"
                        + "Sacrifice is going on tonight\n"
                        + "\n"
                        + "This can't go on I must inform the law\n"
                        + "Can this still be real or just some crazy dream\n"
                        + "But I feel drawn towards the evil chanting hordes\n"
                        + "They seem to mesmerise me ... can't avoid their eyes\n"
                        + "666 the number of the beast\n"
                        + "666 the one for you and me\n"
                        + "\n"
                        + "I'm coming back I will return\n"
                        + "And I'll possess your body and I'll make you burn\n"
                        + "I have the fire I have the force\n"
                        + "I have the power to make my evil take it's course\n";
                txtRolagem.setText(lyrics);
            } else {
                int sucesso = 0;
                for (int i = 0; i < Integer.parseInt(txtParadaDados.getText()); i++) {
                    int dado = Integer.parseInt((Math.random() * 10 +1)+"");
                    txtRolagem.setText(txtRolagem.getText() + "   " + dado);
                    if (dado >= 8) {
                        sucesso++;
                    }
                    lblResult.setText("" + sucesso);
                }
            }
            btoRolar.setText("Nova Rolagem");
        } else{
            txtParadaDados.setText("");
            txtRolagem.setText("");
            lblResult.setText("");
            btoRolar.setText("Rolar");
            txtParadaDados.requestFocus();
        }

}//GEN-LAST:event_btoRolarActionPerformed

    private void btoSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btoSairActionPerformed
        FrmPrincipal.mnuRoladorRequiem.setEnabled(true);
        dispose();                                   
    }//GEN-LAST:event_btoSairActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FrmRoladorRequiem().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btoRolar;
    private javax.swing.JButton btoSair;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblParadaDados;
    private javax.swing.JLabel lblResult;
    private javax.swing.JLabel lblSucessos;
    private javax.swing.JTextField txtParadaDados;
    private javax.swing.JTextArea txtRolagem;
    // End of variables declaration//GEN-END:variables
}
